<?php
require_once 'Response.php';
require_once 'DB.php';
header('Content-Type:text/json;charset=utf-8');
# 设置允许跨域
header("Access-Control-Allow-Origin: *");
$pdo = DB::getInstance()->connect();
$name=$_REQUEST['name'];
$price=$_REQUEST['price'];
$image=$_REQUEST['image'];
$content=$_REQUEST['content'];
$state=$_REQUEST['state'];
$date=$_REQUEST['date'];
//var_dump($date);
$sql="INSERT INTO menu(name,price,img,content,state,sell_time) 
      VALUES ('$name',$price,'$image','$content','$state','$date')";
//var_dump($sql);
$count=$pdo->exec($sql);
var_dump($count);
if($count>=1){
    echo "<script>alert('添加成功！');</script>>";
}

